<template>
  <div id="center">
    <div class="up">
      <div
          class="bg-color-black item"
          v-for="item in titleItem"
          :key="item.title"
      >
        <span class="ml-3 fw-b fs-xl title-text">{{ item.title }}</span>
        <div>
          <dv-digital-flop
              class="dv-dig-flop ml-1 mt-2 pl-3"
              :config="item.number"
          />
        </div>
      </div>
    </div>
    <div class="down">
      <div class="ranking bg-color-black">
        <span>
          <icon name="chart-pie" class="text-icon"></icon>
        </span>
        <span style="color: white; font-size: 17px; margin-left: 0.5rem; margin-right: 0.5rem;">
          产品入库
        </span>
        <dv-scroll-ranking-board class="dv-scr-rank-board mt-1" :config="ranking" />
      </div>
      <div class="percent">
        <div class="item bg-color-black">
          <span class="chart-title">今日任务通过率</span>
          <CenterChart
              :id="rate[0].id"
              :tips="rate[0].tips"
              :colorObj="rate[0].colorData"
          />
        </div>
        <div class="item bg-color-black">
          <span class="chart-title">今日任务达标率</span>
          <CenterChart
              :id="rate[1].id"
              :tips="rate[1].tips"
              :colorObj="rate[1].colorData"
          />
        </div>
        <div class="water">
          <dv-water-level-pond class="dv-wa-le-po" :config="water" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CenterChart from '@/components/echart/center/centerChartRate'

export default {
  data() {
    return {
      titleItem: [
        {
          title: '无脚转换器（上盖）',
          number: {
            number: [
              35340
            ],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '836锅盖把手373',
          number: {
            number: [22],
            toFixed: 1,
            textAlign: '917',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: 'BH有孔底板',
          number: {
            number: [
              203953
            ],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '2769上把手',
          number: {
            number: [4370
            ],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '2481电盖',
          number: {
            number: [
              4360],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '8216A2深锅握把',
          number: {
            number: [2738],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        }
      ],
      ranking: {
        data: [
          { name: '2860右脚架(新肉厚)', value: 10500 },
          { name: '2904转轴盖（大）', value: 1521 },
          { name: '2904转轴套（小）', value: 1521 },
          { name: '2976左抬杆', value: 2000 },
          { name: 'BH有孔底板', value: 80 },
          { name: '836锅盖把手373', value: 3240 },
          { name: '2704隔热块', value: 53000 },
          { name: '8216电源座CNS', value: 800 },
          { name: '1293左脚架', value: 14700 },
          { name: '1290左脚架', value: 2800 }
        ],
        carousel: 'single',
        unit: ''
      },
      water: {
        data: [24, 45],
        shape: 'roundRect',
        formatter: '{value}%',
        waveNum: 3
      },
      rate: [
        {
          id: 'centerRate1',
          tips: 90,
          colorData: {
            textStyle: '#3fc0fb',
            series: {
              color: ['#00bcd44a', 'transparent'],
              dataColor: {
                normal: '#03a9f4',
                shadowColor: '#97e2f5'
              }
            }
          }
        },
        {
          id: 'centerRate2',
          tips: 88,
          colorData: {
            textStyle: '#67e0e3',
            series: {
              color: ['#faf3a378', 'transparent'],
              dataColor: {
                normal: '#ff9800',
                shadowColor: '#fcebad'
              }
            }
          }
        }
      ]
    }
  },
  components: {
    CenterChart
  }
}
</script>

<style lang="scss" scoped>
#center {
  display: flex;
  flex-direction: column;

  .up {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;

    .item {
      position: relative;
      border-radius: 6px;
      padding-top: 8px;
      margin-top: 8px;
      width: 32%;
      height: 70px;

      .title-text {
        display: block;
        margin: 0;
        color: white !important;
        text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
        line-height: 1.3;
        /* 新增：强制设置字体大小和不透明度 */
        font-size: 14px;
        opacity: 1;
      }

      .dv-dig-flop {
        width: 150px;
        height: 30px;
        ::v-deep .digital-flop-number {
          color: white !important;
          fill: white !important;
        }
      }
    }
  }

  .down {
    padding: 6px 4px;
    padding-bottom: 0;
    width: 100%;
    display: flex;
    height: 255px;
    justify-content: space-between;

    .bg-color-black {
      border-radius: 5px;
    }

    .ranking {
      padding: 10px;
      width: 59%;

      .dv-scr-rank-board {
        height: 225px;
        ::v-deep .scroll-ranking-board-item-name {
          color: white !important;
        }
        ::v-deep .scroll-ranking-board-item-value {
          color: white !important;
        }
      }
    }

    .percent {
      width: 40%;
      display: flex;
      flex-wrap: wrap;

      .item {
        width: 50%;
        height: 120px;

        .chart-title {
          margin-top: 8px;
          font-size: 14px;
          display: flex;
          justify-content: center;
          color: white !important;
          text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
        }
      }

      .water {
        width: 100%;

        .dv-wa-le-po {
          height: 120px;
          ::v-deep .water-level-pond-text {
            fill: white !important;
          }
        }
      }
    }
  }
}

/* 全局兜底：确保标题在任何情况下都是白色 */
#center .title-text,
#center .chart-title {
  color: white !important;
}
</style>